//
//  BaseWebViewController.m
//  danpin
//
//  Created by chuangjia on 16/11/2015.
//  Copyright © 2015 chuangjia. All rights reserved.
//

#import "BaseWebViewController.h"

#import "ZShare.h"
@interface BaseWebViewController()<UIWebViewDelegate>
@property(nonatomic,strong)UIWebView *webView;
@end

@implementation BaseWebViewController
@synthesize titleStr=_titleStr;
@synthesize urlStr=_urlStr;

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.isComment=YES;
    self.navTitle =_titleStr;
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, self.navHeight, self.view.frame.size.width, self.view.frame.size.height-self.navHeight)];
    [_webView setDelegate:self];
    NSString *urlstr =_urlStr;
    if ([urlstr isEqualToString:@"<null>"]) {
        urlstr =@"";
    }
    [ZShare showAnimationView:self.view center:CGPointZero];
    NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:urlstr]];
    [self.view addSubview: _webView];
    [_webView loadRequest:request];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    DLog(@"%s", __PRETTY_FUNCTION__);
}

- (void) webViewDidStartLoad:(UIWebView *)webView
{
    DLog(@"webViewDidStartLoad");
}
- (void) webViewDidFinishLoad:(UIWebView *)webView
{
    [ZShare hiddenAnimationView:self.view];
    DLog(@"webViewDidFinishLoad");
}
- (void) webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    [ZShare hiddenAnimationView:self.view];
    DLog(@"didFailLoadWithError:%@", error);
}

@end

